CC=gcc

SRV=SystemV_ShmWrite
CLI=SystemV_ShmRead

ROOT_DIR=$(shell pwd)
INCLUDE_PATH := $(ROOT_DIR)/../../common/include/ \
                $(ROOT_DIR)/../../applib/include/
LIBRARY_PATH := $(ROOT_DIR)/../../output/
OUTPUT_PATH := $(ROOT_DIR)/../../output/

LIBS := AppLib Common pthread rt

CFLAGS  += $(foreach dir, $(INCLUDE_PATH), -I$(dir))
LDFLAGS += $(foreach lib, $(LIBRARY_PATH), -L$(lib))
LDFLAGS += $(foreach lib, $(LIBS), -l$(lib))

all: SRV CLI

SRV: 
	gcc -o $(OUTPUT_PATH)/${SRV}  ${SRV}.c ${CFLAGS} ${LDFLAGS}

CLI:
	gcc -o $(OUTPUT_PATH)/${CLI}  ${CLI}.c ${CFLAGS} ${LDFLAGS}

clean:
	rm -rf $(OUTPUT_PATH)/${SRV} $(OUTPUT_PATH)/${CLI}
